<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>码猿博客</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../bootstrap/bootstrap.min.css">
    <link rel="stylesheet" href="../sweetAlert/sweetalert.css">
    <link rel="ICON" href="../image/projectImage/icon1.png">
    <link rel="stylesheet" href="../css/public.css">
    <link rel="stylesheet" href="../font-awesome/css/font-awesome.min.css">
</head>
<body>
<header id="header-box">
    <nav class="navbar navbar-default m-b-0"  >
        <div class="container-fluid"  >
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header" >
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="../my_home">码猿</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="./../my_home"><i class="fa fa-home m-r-5"></i>主页</a></li>
                    <li class="active"><a href="./../my_library"><i class="fa fa-book m-r-5"></i>博客</a></li>
                    <li><a href="./../externalLink"><i class="fa fa-map-signs m-r-5"></i>外链</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right" th:if="${#httpServletRequest.remoteUser}==null">
                    <li><a href="./../userLogin">未登录</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right" th:if="${#httpServletRequest.getAttribute('Username')}!=null">
                    <li class="dropdown">
                        <a href="javascript:" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="padding: 9px 15px">[[${#httpServletRequest.getAttribute("Username")}]]<img class="m-l-5" th:src="'./../image/userImage/'+${#httpServletRequest.remoteUser}+'/userInfo.png'" alt=""><span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a th:href="'./../userInfo?userAccount='+${#httpServletRequest.remoteUser}">用户信息</a></li>
                            <li><a href="./../changePassword">修改密码</a></li>
                            <li><a th:href="'./../writeArticle?userAccount='+${#httpServletRequest.remoteUser}">发布博客</a></li>
                            <li>
                                <form class="p-0" style="color: #4c4c4c;cursor: pointer;" th:action="@{./../logout}" method="post" id = "logoutForm">
                                    <a style="color: #333; padding: 3px 20px" onclick="javascript:$('#logoutForm').submit()"/>退出登录</a>
                                </form>
                            </li>
                        </ul>
                    </li>
                </ul>
                <div class="navbar-form navbar-right">
                    <div class="input-group">
                        <input type="text" class="form-control"  placeholder="Search" v-model="researchText">
                        <span class="input-group-addon btn btn-info" v-on:click="researchUrl='./../researchPage';research_btn()"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>
    <div class="Sidebar">
        <a href="./../my_home" title="码猿主页"><i class="fa fa-home fa-lg"></i></a>
        <a href="javascript:;" class="stick" title="置顶" style="display: none"><i class="fa fa-eject"></i></a>
    </div>
</header>

<div class="center clear" id="card-box">
    <div class="container">
        <div class="details-position">
            <a href="./../my_home">首页</a><span> > </span><a href="./../my_library">博客</a><span> > </span><a>
            <div v-cloak>{{library.libraryName}}</div></a>
        </div>
        <div class="title-box">
            <div class="course-details">
                <div class="details-img m-r-20 f-l">
                    <img width="450" height="250" src="./../image/projectImage/libraryList.jpg">
                </div>
                <div class="details-box" v-cloak>
                    <div class="collection-btn f-r p-r-10">
                        <i class="fa fa-star-o fa-lg"></i>
                    </div>
                    <h2 class="details-title p-l-10" v-cloak>
                        {{library.libraryName}}
                    </h2>
                    <p class="abstract-type m-b-0" v-cloak>
                        {{library.libraryIntro}}
                    </p>
                </div>
                <div class="course-btn" v-cloak>
                    <a v-bind:href="library.dynamicLibraryUrl" class="btn btn-info btn-sm" target="_blank">知识图库</a>
                </div>
                <div class="share-btn text-right" v-cloak>
                    <a href="javascript:;" title="分享到QQ"><i class="fa fa-qq"></i></a>
                    <a href="javascript:;" title="分享到微信"><i class="fa fa-weixin"></i></a>
                    <a href="javascript:;" title="分享到微博"><i class="fa fa-weibo"></i></a>
                </div>
            </div>
            <div class="menu-box">
                <ul class="details-menu">
                    <li class="f-l">
                        <a class="on" href="#">目录</a>
                    </li>
                    <li class="f-l">
                        <a class="" href="#">笔记</a>
                    </li>
                    <li class="f-l">
                        <a class="" href="#">讨论区</a>
                    </li>
                    <li class="f-r">
                        <a class="" href="#">问答</a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="course-box m-b-20" id="catalog-box">
            <div class="catalog-box">
                <div class="catalog-title">
                    <h2 class="">目录</h2>
                </div>
                <div class="loading text-center" v-show="bool_loading1">
                    <img src="../image/projectImage/loading.gif" alt="" width="300" height="160">
                </div>
                <div class="catalog-content" v-show="!bool_loading1">
                    <div class="catalog-detail" v-for="libraryList in libraryList" v-cloak>
                        <a v-bind:href="'./.'+libraryList.articleUrl" target="_blank">
                            <i class="fa fa-file-text-o m-r-10"></i>{{libraryList.articleTitle}}
                        </a>
                        <p style="color: #555;" class="p-l-20">
                            <span class="f-r" v-cloak>发布时间：{{libraryList.articleDate}}</span>
                            <span class="m-r-20" v-cloak>作者：{{libraryList.publisher}}</span>
                        </p>
                    </div>
                    <div v-show="!libraryList.length" class="p-t-20 p-b-30" style="font-size: 22px" v-cloak>
                        暂无数据！！！
                    </div>
                </div>
                <div class="catalog-footer" v-show="!bool_loading1&&libraryList.length">
                    <nav aria-label="Page navigation" v-show="libraryList.length">
                        <ul class="pagination">
                            <li v-if="currentPage>1">
                                <a href="javaScript:;" aria-label="Previous" class="m-l-20" v-on:click="currentPage--,retrieveData();">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li v-else>
                                <a href="javaScript:;" class="m-l-20">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li class="page-1" v-for="index in indexs" v-bind:class="{'active': currentPage === index}">
                                <a href="javaScript:;" class="button" :value="index" v-if="currentPage === index" v-cloak>{{index}}</a>
                                <a href="javaScript:;" class="button" :value="index" v-on:click="currentPage = index,retrieveData();" v-else v-cloak>{{index}}</a>
                            </li>
                            <li v-if="currentPage<totalPages">
                                <a href="javaScript:;" aria-label="Next" v-on:click="currentPage++,retrieveData();">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                            <li v-else >
                                <a href="javaScript:;" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
    </div>
</div>

<footer class="footer">
    <div class="container text-center">
        <div class="row footer-top m-t-35">
            <div class="footer-icon">
                <a href="#" class="m-r-25" title="新浪微博"><i class="fa fa-weibo fa-2x"></i></a>
                <a href="javascript:;" class="m-r-25" title="微信"><i class="fa fa-weixin fa-2x"></i></a>
                <a href="javascript:;" class="m-r-25" title="腾讯QQ"><i class="fa fa-qq fa-2x"></i></a>
                <a href="#" title="Github"><i class="fa fa-github-alt fa-2x"></i></a>
            </div>
        </div>
        <div class="footer-link m-t-5">
            <!-- <a href="/about/us" target="_blank" title="关于我们">关于我们</a> -->
            <a href="#" target="_blank" title="企业合作" class="m-r-25">企业合作</a>
            <a href="#" target="_blank" title="人才招聘" class="m-r-25">人才招聘</a>
            <a href="#" target="_blank" title="联系我们" class="m-r-25">联系我们</a>
            <a href="#" target="_blank" title="讲师招募" class="m-r-25">讲师招募</a>
            <a href="#" target="_blank" title="常见问题" class="m-r-25">常见问题</a>
            <a href="#" target="_blank" title="意见反馈" class="m-r-25">意见反馈</a>
            <a href="#" target="_blank" title="意见反馈" class="m-r-25">慕课大学</a>
            <a href="#" target="_blank" title="友情链接">友情链接</a>
        </div>
        <div class="row footer-bottom">
            <p>ML&nbsp;&nbsp;&copy;&nbsp;2017-2017&nbsp;&nbsp;<a href="my_home.html">码猿学习网</a>&nbsp;&nbsp;版本所有</p>
        </div>
    </div>
</footer>
<script src="../js/jquery-3.0.0.min.js"></script>
<script src="../bootstrap/bootstrap.min.js"></script>
<script src="../sweetAlert/sweetalert.min.js"></script>
<script src="../js/vue.js"></script>
<script src="../js/public.js"></script>
<script>
    vm_libraryList=new Vue({
        el:"#card-box",
        data: {
            bool_loading1: true,//是否在加载目录数据
            bool_loading2: true,//是否在加载目录头数据
            library:"", //第一条数据有用
            libraryList:"", //页面列表数据
            totalPages: "", //页数总量
            currentPage: 1 //当前页
        },
        methods: {
            retrieveData: function() {
                getLibraryList();
            }
        },
        computed: {
            indexs: function() {
                var left = 1;
                var right = this.totalPages;
                var ar = [];
                if(this.totalPages >= 7) {
                    if(this.currentPage > 3 && this.currentPage < this.totalPages - 2) {
                        left = this.currentPage - 3;
                        right = this.currentPage + 2
                    } else {
                        if(this.currentPage <= 3) {
                            left = 1;
                            right = 6
                        } else {
                            right = this.totalPages;
                            left = this.totalPages - 5
                        }
                    }
                }
                while(left <= right) {
                    ar.push(left);
                    left++
                }
                return ar
            }
        },
    });

    getLibraryList();
    function getLibraryList() {
        var current_href=window.location.href;
        var n=current_href.split('/');
        var libraryCode=n[4];
        var str={
            currentPage:vm_libraryList.currentPage-1,
            libraryCode:libraryCode,
        }
        console.log(str)
        $.ajax({
            type: 'GET',
            url: './get_libraryList',
            data:str,
            success:function(data) {
                console.log(data);
                vm_libraryList.libraryList = data.content;
                for(var i=0;i<data.content.length;i++){
                    var date=vm_libraryList.libraryList[i].articleDate.split(' ');
                    vm_libraryList.libraryList[i].articleDate=date[0];
                }
                vm_libraryList.totalPages = data.totalPages;
                vm_libraryList.bool_loading1 = false;
            }
        });
        $.ajax({
            type: 'GET',
            url: './../get_one_library',
            data:str,
            success:function(data) {
                console.log(data)
                vm_libraryList.library = data[0];
                vm_libraryList.bool_loading2 = false;
            }
        });
    }
</script>
</body>
</html>

